package com.qf.hospital.serialize;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @author 何星宇
 * @version V1.0
 * @Date 2021/10/20 14:10
 */
public class HiddenCarIdJsonSerializer extends JsonSerializer<String> {
    @Override
    public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeString(s.substring(0, 3)+"****"+s.substring(s.length()-4));
    }
}
